home *** CD-ROM | disk | FTP | other *** search
- #ifndef __PREFERENCES__
- #define __PREFERENCES__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
-
-
- OSErr ReadPreferences(OSType prefType, OSType prefCreator, short prefLocID);
- /*
- ** ¶ Read the application's preference information.
- **
- ** INPUT: prefType If there is no preference file yet, then create
- ** one of this type.
- ** INPUT: prefCreator If there is no preference file yet, then create
- ** one of using this creator (self, assumably).
- ** prefLocID The ID of a 'STR#' resource that contains the
- ** preferences folder name in string 1 and the
- ** preferences file name in string 2.
- ** RESULT: OSErr
- **
- ** If you want framework preferences support, then you need to make this call during
- ** startup in your application. (AppWannabe already does.) It does the following:
- ** 1. Try to create the designated preferences folder/file.
- ** 2. Open the preferences file resource fork.
- ** 3. Read in resource 'aprf' ID #128.
- **
- ** Note that if the 'aprf' resource isn't in the preferences file, then since
- ** it is a resource, it may get it out of the resource chain elsewhere. Therefore
- ** if you want to ship your application with default preferences, first allow
- ** your application to create the preferences file, and then copy the 'aprf' ID #128
- ** resource from the preferences files into your application.
- **
- ** The AppsToGo editor does support window position as a preference for runtime-only
- ** documents (starting with version 6.0 of the editor).
- **
- ** Using version 6.0 of the editor, if you choose "Preserve Doc Screen Location" for a
- ** runtime-only document, AND if you are using the framework preferences facility, then the
- ** window position and visibility will be recorded in the preferences file.
- **
- ** __________
- **
- ** Also see: WritePreferences, GetPreference. */
-
- OSErr WritePreferences(void);
- /*
- ** ¶ Write the application's preference information.
- **
- ** RESULT: OSErr
- **
- ** If you want framework preferences support, then you need to make this call
- ** during shutdown in your application.
- **
- ** The AppsToGo editor does support window position as a preference for runtime-only
- ** documents. Ify you choose "Preserve Doc Screen Location" for a runtime-only
- ** document, AND if you are using the framework preferences facility, then the window
- ** position and visibility will be recorded in the preferences file.
- **
- ** __________
- **
- ** Also see: ReadPreferences, GetPreference. */
-
- TreeObjHndl GetPreference(OSType prefType, Boolean *newPref);
- /*
- ** ¶ Get a preferences reference by type.
- **
- ** INPUT: prefType The OSType (AppsToGo editor) to search for.
- ** newPref If nil is passed in, then if the requested type is
- ** not found, nil is returned. If you pass in a pointer,
- ** then if the requested type is not found, one is created
- ** and returned, and true is returned to indicate that
- ** a new preference was created.
- ** RESULT: TreeObjHndl AppsToGo uses this object to hold the window position
- ** information. However, you can add children to this
- ** object of any type you wish to store whatever you wish.
- **
- ** Note that you can add 'aprf' children to the preference root directly if you wish.
- ** You may wish to do this to have a place to store extra preference information.
- ** Just call NewChild in the same fashion that GetPreference does, and then add
- ** children to the preference object of your own type.
- **
- ** __________
- **
- ** Also see: ReadPreferences, WritePreferences. */
-
-
-
- #ifdef __cplusplus
- }
- #endif
-
-
-
- #endif
-